<table id="box-table-a">
	<thead>
		<tr>
			<th scope="col" width="100">ชื่อผู้ส่ง</th>
			<th scope="col" width="50">หมายเลขโทรศัพท์</th>
			<th scope="col" width="100">E-mail</th>
			<th scope="col" width="100">บริษัท</th>
			<th scope="col" width="200">หัวข้อ</th>
			<th scope="col" width="100">เวลาที่ติดต่อ</th>
			<th scope="col" width="10">อ่าน</th>
			<th scope="col" width="10">ลบ</th>
		</tr>
	</thead>
	<tbody>

	<?php
	include '../../../inc/reuse/dbconfig.php';
	if($_GET)
	{
		$page=$_GET['page'];
	}
	$per_page = 20;
	$start = ($page-1)*$per_page;
	$sql = "SELECT * FROM contacts ORDER BY contacts_date_time limit $start,$per_page";
	$rsd = mysql_query($sql);
	while($row = mysql_fetch_array($rsd))
	{
		$image ="";
		if($row['contacts_active'] == 1) 			$image = "<img src=\"images/template/icon-new.gif\" />";
		/* else{
		 if($row['contacts_reply'] == 0)		$image = "<img src=\"images/template/fwd_icon.png\" />";
		} */
		$date = $row['contacts_date_time'];
		$date = substr($date, 6,2)." ".date("M", mktime(0, 0, 0, substr($date, 4,2), 1))." ".substr($date, 0,4).", ".substr($date, 8,2).":".substr($date, 10,2);
		echo "<tr>
			<td>".$row['contacts_from_sender']."</td>
			<td>".$row['contacts_from_sender_phone']."</td>
			<td>".$row['contacts_from_sender_email']."</td>
			<td>".$row['contacts_from_company']."</td>
			<td>".$row['contacts_title']."$image</td>
			<td>".$date."</td>
			<td><a href=\"contacts_view.php?contacts_id=".$row['contacts_id']."\"><img src=\"images/symbol/edit.png\" /></a></td>
			<td><a href=\"#\" onClick=\"contacts_Delete(".$row['contacts_id'].",'".$row['contacts_title']."')\"><img src=\"images/symbol/delete.png\" /></a></td>
		</tr>";		
}
?>
	</tbody>
</table>
